package com.example.go_drink_water_plugin.component;


import com.example.go_drink_water_plugin.AppConfig;
import com.example.go_drink_water_plugin.ReminderTask;

/**
 * @author wanghuafu
 * @version 0.1
 * @date 2023/11/30
 */
public class SettingsDialogDelegate {


    public static void toConfig(){
        // 实现打开设置对话框的逻辑
        SettingsDialog dialog = new SettingsDialog();
        dialog.show();

        if (dialog.isOK()) {
            boolean isReminderEnabled = dialog.isReminderEnabled();
            int reminderInterval = dialog.getReminderInterval();
            AppConfig.isReminderEnabled = isReminderEnabled;
            AppConfig.reminderInterval = reminderInterval;
            if (isReminderEnabled) {
                ReminderTask.startReminder(reminderInterval);
            } else {
                ReminderTask.close();
            }
        }
    }
}
